<extend name="Base/common"/>
<block name="Content">
	<div class="am-cf am-padding-top">
        <div class="am-fl am-cf">
            <i class="am-icon-pencil-square-o"></i>
            <strong class="am-text-primary am-text-lg">
               <notempty name="userModel">
                    编辑<else/>新增
                </notempty>用户
            </strong>
        </div><hr data-am-widget="divider" class="am-divider am-divider-default" />
    </div>
                <form class="am-form" method="post" action="{:U('saveAction')}">
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            账号
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="text" class="am-input-sm" required
                            	name="account" value="{$userModel['account']}" pattern="^1(3|4|5|7|8)\d{9}$"
                            	<notempty name="userModel['account']"> readonly </notempty>>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <notempty name="userModel">
                    <else/>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            用户密码
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                             <input type="password" name="password" id="password" 
                             	class="am-form-field am-input-sm" value="{$Think.config.INIT_PWD}" />
                        </div>
                        <div class="am-hide-sm-only am-u-md-7">
                            *新增用户初始密码：{$Think.config.INIT_PWD}
                        </div>
                    </div>
                    </notempty>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            姓名
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="username" value="{$userModel['username']}" required/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            性别 
                        </div>
                        <div class="am-u-sm-8 am-u-md-3">
                            <input type="radio" name="sex" value="1"/>男<input type="radio" name="sex" value="2"/>女 
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    
                    <div class="am-margin">
                        <button type="submit" class="am-btn am-btn-success am-btn-xs ajax-post" target-form="am-form">
                            提交保存
                        </button>
                        <button type="button" class="am-btn am-btn-danger am-btn-xs" onclick="order()">
                            一键下单
                        </button>
                        <button type="button" class="am-btn am-btn-secondary am-btn-xs" onclick="javascript:history.back(-1);return false;">
                            返回列表
                        </button>
                        <input type="hidden" name="user_id" value="{$userModel['user_id']}"/>
                        <input type="hidden" name="smt_type" id="smt_type" value="1"/>
                    </div>
                </form>
    </div>
</block>

<block name="script">
<script type="text/javascript">
Think.setValue('sex',{$userModel.sex|default=1});

function order(){
	
	//1:只新增用户；2：新增用户成功后，跳转到下单页面
	$("#smt_type").val('2');
	$(".am-form").submit();
}

</script>

</block>